import React from 'react';
import { Tag } from 'antd';
import { CONCLUSION_STATUS, CONCLUSION_STATUS_VALUES } from '../../constants';
// 面试总结状态

const INTERVIEW_NOT_SUMMARIZED = -1;
const INTERVIEW_NOT_SUMMARIZED_LABEL = '待总结';
const INTERVIEW_NOT_SUMMARIZED_COLOR = 'orange';

const COLOR_MAPPING = {
    [CONCLUSION_STATUS_VALUES.CONTINUED]: 'blue',
    [CONCLUSION_STATUS_VALUES.EARLY]: 'green',
    [CONCLUSION_STATUS_VALUES.ALLOWABLE]: 'green',
    [CONCLUSION_STATUS_VALUES.TERMINATE]: 'red',
    [CONCLUSION_STATUS_VALUES.INSPECT]: 'red'
};

export const TYPES = {
    CONCLUSION: 'conclusion',
    SUMMARY: 'summary'
};

export default function InterviewTag({ type = TYPES.CONCLUSION, status, ...rest }) {
    const flag = type === TYPES.SUMMARY && status === INTERVIEW_NOT_SUMMARIZED;
    const color = flag ? INTERVIEW_NOT_SUMMARIZED_COLOR : COLOR_MAPPING[status];
    const text = flag ? INTERVIEW_NOT_SUMMARIZED_LABEL : CONCLUSION_STATUS[status];
    return (
        <Tag {...rest} color={color}>
            {text}
        </Tag>
    );
}
